package com.jinkaimen.goodcash.factory;


import android.os.Bundle;
import android.util.SparseArray;

import com.ht.baselibs.ui.base.BaseFragment;
import com.jinkaimen.goodcash.ui.fragment.HomeFragment;
import com.jinkaimen.goodcash.ui.fragment.SelfFragment;


public class FragmentFactory {
	
	public static final int FRAGMENT_HOME_TAB0 = 0;
	public static final int FRAGMENT_HOME_TAB1 = 1;
	public static final int FRAGMENT_HOME_TAB2 = 2;
	public static final int FRAGMENT_HOME_TAB3 = 3;

	public static final SparseArray<BaseFragment> mHomeTabMap = new SparseArray();
    
	public static BaseFragment getHomeTabFragment(int position) {
		BaseFragment fragment = mHomeTabMap.get(position);

        if (fragment == null){
			switch (position) {
			case FRAGMENT_HOME_TAB0:
				fragment = new HomeFragment();
				break;
			case FRAGMENT_HOME_TAB1:
				fragment = new SelfFragment();
				break;
			}
            mHomeTabMap.put(position, fragment);
            Bundle bundle = new Bundle();
            bundle.putBoolean(BaseFragment.IS_ATTACH_FRAGMENT_LAYOUT, true);
            fragment.setArguments(bundle);
		}
		return fragment;
	}
}
